home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / source / gfxfx / bigscree.pas < prev    next >
Pascal/Delphi Source File  |  1994-06-22  |  2KB  |  70 lines

  1.  
  2. program plasma;
  3. uses
  4.   crt;
  5. const
  6.   vidseg:word=$a000;
  7.   border:boolean=false;
  8. var
  9.   stab1,stab2:array[0..255] of byte;
  10.   address,x,y:word;
  11.   i1,i2,j1,j2,c:byte;
  12.  
  13. procedure setmode; assembler; asm
  14.   mov ax,0013h; int 10h; mov dx,03c4h; mov ax,0604h; out dx,ax; mov dx,03d4h
  15.   mov ax,4609h; out dx,ax; mov ax,0014h; out dx,ax; mov ax,0e317h; out dx,ax
  16.   mov es,vidseg; xor di,di; xor ax,ax; mov cx,16000; rep stosw; end;
  17.  
  18. procedure setborder(col:byte); assembler; asm
  19.   xor ch,ch; mov cl,border; jcxz @out; mov dx,3dah; in al,dx
  20.   mov dx,3c0h; mov al,11h+32; out dx,al; mov al,col; out dx,al; @out: end;
  21.  
  22. procedure setpal(c,r,g,b:byte); assembler; asm
  23.   mov dx,3c8h; mov al,[c]; out dx,al; inc dx; mov al,[r]
  24.   out dx,al; mov al,[g]; out dx,al; mov al,[b]; out dx,al; end;
  25.  
  26. procedure retrace; assembler; asm
  27.   mov dx,3dah; @vert1: in al,dx; test al,8; jz @vert1
  28.   @vert2: in al,dx; test al,8; jnz @vert2; end;
  29.  
  30. procedure setaddress(ad:word); assembler; asm
  31.   mov dx,3d4h; mov al,0ch; mov ah,[byte(ad)+1]; out dx,ax
  32.   mov al,0dh; mov ah,[byte(ad)]; out dx,ax; end;
  33.  
  34. begin
  35.   setmode;
  36.   for x:=0 to 63 do begin
  37.     setpal(x,x div 4,x div 2,x);
  38.     setpal(127-x,x div 4,x div 2,x);
  39.     setpal(127+x,x,x div 4,x div 2);
  40.     setpal(254-x,x,x div 4,x div 2);
  41.   end;
  42.   for x:=0 to 255 do begin
  43.     stab1[x]:=round(sin(2*pi*x/255)*128)+128;
  44.     stab2[x]:=round(cos(2*pi*x/255)*128)+128;
  45.   end;
  46.  
  47.   i1:=50; j1:=90; address:=0;
  48.   repeat
  49.     retrace;
  50.     setborder(30);
  51.     if address=0 then address:=16000 else address:=0;
  52.     setaddress(address);
  53.     inc(i1,-1);
  54.     inc(j1,2);
  55.     for y:=0 to 56 do begin
  56.       i2:=stab1[(y+i1) mod 255];
  57.       j2:=stab1[j1 mod 255];
  58.       for x:=0 to 79 do begin
  59.         c:=stab1[(x+i2) mod 255]+stab2[(y+j2) mod 255];
  60.         mem[vidseg:address+y*80+x]:=c mod 255;
  61.       end;
  62.     end;
  63.     setborder(0);
  64.   until keypressed;
  65.  
  66.   textmode(lastmode);
  67. end.
  68.  
  69. { Simple, yet sufficiant plasma }
  70.